/**
 * 罗马数字有以下七种对应
 *     
I: 1, 
V: 5,
X: 10,
L: 50,
C: 100,
D: 500,
M: 1000,
比如：12写成XII，即X+II
     27写成XXVII，即XX+V+II
有以下特殊：
IV: 4,
IX: 9,
XL: 40,
XC: 90,
CD: 400,
CM: 900
 * @param {*} str 
 * @returns 
 */
function luomaNum(str = "") {
    let map = {
        I: 1,
        V: 5,
        X: 10,
        L: 50,
        C: 100,
        D: 500,
        M: 1000,
        IV: 4,
        IX: 9,
        XL: 40,
        XC: 90,
        CD: 400,
        CM: 900
    };
    let i = 0;
    let sum = 0;
    while (str.length) {
        let two = str.slice(0, 2);
        if (map[two]) {
            sum += map[two];
            str = str.slice(2);
        } else {
            let one = str[0];
            if (map[one]) {
                sum += map[one];
                str = str.slice(1);
            }
        }
        // let one = str.slice(0, 2);
        // if (map[two]) {
        //     sum+=map[two];
        //     str = str.slice(2);
        // }
        // let num = 
    }
    return sum;
}